package com.bankwel.j2d;

import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;

import com.bankwel.j2d.core.J2dChannel;
import com.bankwel.j2d.core.J2dMatrix;
import com.bankwel.j2d.model.Circle;
import com.bankwel.j2d.model.Object2d;
import com.bankwel.j2d.ui.J2dFrame;
import com.bankwel.j2d.ui.J2dPanel;
import com.bankwel.j2d.ui.J2dProxy;

/**
 * Hello world!
 *
 */
public class App {
	public static void main(String[] args) {
		JFrame frame = new J2dFrame();
		Object2d obj = new Circle(0,500, 50);
		JPanel panel = new J2dPanel(obj);

		float pi = (float) Math.PI;
		J2dMatrix action = J2dChannel.translate(1, 1);
		action.join(J2dChannel.rotate(pi / 180));
		//action.join(J2dChannel.shear(0, 0.1f));

		ActionListener proxy = new J2dProxy(obj, panel, action);
		frame.add(panel);
		panel.updateUI();

		new Timer(240, proxy).start();
	}
}
